Socket
Socket
Sign inDemoInstall

svelte

Package Overview
Dependencies
0
Maintainers
3
Versions
644
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    svelte

Cybernetically enhanced web apps


Version published
Weekly downloads
1.2M
increased by3.6%
Maintainers
3
Created
Weekly downloads
 

Package description

What is svelte?

Svelte is a modern JavaScript compiler that allows you to write high-performance user interfaces with significantly less boilerplate code than traditional frameworks. It shifts much of the work to compile time, producing highly optimized vanilla JavaScript at the end.

What are svelte's main functionalities?

Reactive Declarations

Svelte allows you to write reactive statements using the $: syntax. When the state changes, the reactive statements automatically update to reflect the new state.

let count = 0;

$: doubled = count * 2;

Component Definition

Components in Svelte are defined using a combination of HTML, CSS, and JavaScript, which are encapsulated within a single file with a .svelte extension.

<script>
  export let name;
</script>

<h1>Hello {name}!</h1>

Store Management

Svelte provides a simple store mechanism to manage global state. The 'writable' store is a basic store that allows reading and writing values reactively.

import { writable } from 'svelte/store';

const count = writable(0);

Transitions and Animations

Svelte makes it easy to add transitions and animations to elements when they enter or leave the DOM.

import { fade } from 'svelte/transition';

<div in:fade={{ delay: 0, duration: 200 }}>Fade In</div>

Bindings

Svelte provides a concise syntax for two-way data binding to HTML elements, allowing for easy synchronization between the DOM and component state.

<script>
  let value = '';
</script>

<input bind:value={value} />

Other packages similar to svelte

Readme

Source

Cybernetically enhanced web apps: Svelte

npm version license Chat

What is Svelte?

Svelte is a new way to build web applications. It's a compiler that takes your declarative components and converts them into efficient JavaScript that surgically updates the DOM.

Learn more at the Svelte website, or stop by the Discord chatroom.

Supporting Svelte

Svelte is an MIT-licensed open source project with its ongoing development made possible entirely by fantastic volunteers. If you'd like to support their efforts, please consider:

Funds donated via Open Collective will be used for compensating expenses related to Svelte's development such as hosting costs. If sufficient donations are received, funds may also be used to support Svelte's development more directly.

Roadmap

You may view our roadmap if you'd like to see what we're currently working on.

Development

Pull requests are encouraged and always welcome. Pick an issue and help us out!

To install and work on Svelte locally:

git clone https://github.com/sveltejs/svelte.git
cd svelte
npm install

Do not use Yarn to install the dependencies, as the specific package versions in package-lock.json are used to build and test Svelte.

To build the compiler and all the other modules included in the package:

npm run build

To watch for changes and continually rebuild the package (this is useful if you're using npm link to test out changes in a project locally):

npm run dev

The compiler is written in TypeScript, but don't let that put you off — it's basically just JavaScript with type annotations. You'll pick it up in no time. If you're using an editor other than Visual Studio Code, you may need to install a plugin in order to get syntax highlighting and code hints, etc.

Running Tests

npm run test

To filter tests, use -g (aka --grep). For example, to only run tests involving transitions:

npm run test -- -g transition

svelte.dev

The source code for https://svelte.dev lives in the sites repository, with all the documentation in the site/content directory. The site is built with SvelteKit.

Is svelte.dev down?

Probably not, but it's possible. If you can't seem to access any .dev sites, check out this SuperUser question and answer.

License

MIT

Keywords

FAQs

Last updated on 20 Jun 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc